-
Notifications
You must be signed in to change notification settings - Fork 69
Add TypeScript type definitions #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jbaiter This is great, thanks! Been doing some testing - looks like there's one discrepancy. But the sqlite wasm docs mention some changes which also came up in my testing.
So I guess this would be: This would line up with what I'm seeing at runtime as well. |
|
Thank you for testing the types! I've pushed a fix. |
|
Let me know when it's ready to be merged. |
|
Thanks @jbaiter. Couple more things I found.
|
- Use `readonly T[]` argument types where possible - Fix typo in first `xWrapped` overload - Include `BigInt` in `SqlValue` union type
|
@sampbarrow
Indeed it should! Fixed, thank you!
Oh absolutely, thank you for pointing that out, added the modifier in some other function signatures as well 👍🏾
That probably depends on your definition of 'ready' as a maintainer 😅 . The API surface is huge, and I've done the types to the best of my knowledge, but there's bound to be gaps and mistakes in there that I overlooked. Maybe @sgbeal could take a glance at the types and see if anything obviously wrong jumps out at him? |
|
Is it possible to release the typescript support with the npm "pre-release" semantic version bump, so the community can try it out in their realistic projects and provide feedback? |
I'm open to doing that. How would it work in practice? On npm, our versions use Running $ npm version prerelease --preid=alpha
v3.43.1-alpha.0Can I just add it manually again so it would read |
|
The Since the |
tomayac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and pre-releasing to test this in practice, as agreed on in the PR thread.
Adds TypeScript type definitions for all publicly exposed APIs of the official 3.43.0 build of SQLite's WASM build. Based on initial work by @schickling, @mizchi and @tomayac in #36. Fixes #1.
In addition to the type definitions, every function, struct and class has a docstring. For most APIs this mirrors the online documentation, for the
sqlite.capinamespace the docstrings are abbreviated versions of the docstrings insqlite.h, with a hyperlink to the full documentation. Docstrings forsqlite.capifunctions also include the original C signature, which can be essential when dealing with pointer types.